home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln1185.arc
/
CROSSTH2.LTG
< prev
next >
Wrap
Text File
|
1986-02-27
|
1KB
|
34 lines
Listinτ 2«
PP╠ codσ fo≥ trisectioε roo⌠ seekinτ methoΣ usinτ ß tota∞ oµ tw∩ ì
CPUs.
FUNCTIO╬ Trisection(Guess_A¼ Guess_B¼ Accurac∙ ║ real
FofX(° ║ real⌐ ║ real⌐ returε real
-¡ FofX(x⌐ i≤ thσ functioε whosσ roo⌠ i≤ sought
VA╥ S▒ ║ Process_Signals
BEGIN
INITIALIZE║ Fß ╜ FofX(Guess_A)╗ FΓ ╜ FofX(Guess_B)
LOO╨ <Find_Root>
BEGIN
New_Guess▒ ╜ Guess_┴ ½ (Guess_┬ ¡ Guess_A⌐ » 3
New_Guess▓ ╜ Guess_┬ ¡ (Guess_┬ ¡ Guess_A⌐ » 3
StartFunction(FofX(New_Guess1),Pr,F1,S1)
F▓ ╜ FofX(New_Guess2)
Wait(S1⌐ -¡ wai⌠ fo≥ F▒ result
In_Left_Flaτ ╜ Fß ¬ F▒ ╝ 0╗ In_Right_Flaτ ╜ F▓ ¬ FΓ ╝ 0
I╞ In_Left_Flaτ THE╬ Guess_┬ ╜ New_Guess1╗ FΓ ╜ F1
ELSEI╞ In_Right_Flaτ THE╬ Guess_┴ ╜ M2╗ Fß ╜ F2
ELS┼ Guess_┴ ╜ New_Guess1╗ Fß ╜ F1╗ Guess_┬ ╜ New_Guess2╗ FΓ ╜ F▓
EN─ IF
I╞ ABS(Guess_┴ ¡ Guess_B⌐ <╜ Accurac∙ THE╬ EXI╘ EN─ IF
EN─ LOO╨ <Find_Root>
TERMINATE║ returε ¿ (Guess_┴ ½ Guess_B)/▓ )
EN─ Trisection